package com.buli.blmall.admin.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 登录方式
 * @author xiang.gao
 * @date 2024/12/18 14:50
 */
public enum LoginType {

    /**
     * 密码登录
     */
    PASSWORD("password"),

    /**
     * 短信登录
     */
    SMS_CODE("smsCode"),

    /**
     * 微信
     */
    WECHAT("wechat");

    private final String loginType;

    public String getLoginType() {
        return loginType;
    }

    LoginType(String loginType) {
        this.loginType = loginType;
    }

    public static LoginType getByLoginType(String loginType) {
        for (LoginType value : values()) {
            if (StringUtils.contains(loginType, value.getLoginType())) {
                return value;
            }
        }
        return null;
    }

}
